#include<bits/stdc++.h>
#define fre(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
#define LL long long
#define db double
using namespace std;
int a[10005];
int fr[10005];
int to[10005];
int main(){
	fre(sort);
	int n,m;
	scanf("%d%d",&n,&m);
	a[n+1]=2147483647;
	for(int i=1;i<=n;i++)
	scanf("%d",&a[i]),fr[i]=to[i]=i;
	for(int i=1;i<=n;i++)
	for(int j=i;j>=2;j--)
	if(a[fr[j]]<a[fr[j-1]])
	{
		swap(to[fr[j]],to[fr[j-1]]);
		swap(fr[j],fr[j-1]);
	}
	else break;
	int op,u,v;
	for(int i=1;i<=m;i++){
		scanf("%d",&op);
		if(op==1){
			scanf("%d%d",&u,&v);
			a[u]=v;u=to[u];
			for(;u<n;u++)
			if(a[fr[u]]>a[fr[u+1]]){
				swap(to[fr[u]],to[fr[u+1]]);
				swap(fr[u],fr[u+1]);
			}
			else if(a[fr[u]]==a[fr[u+1]]&&fr[u]>fr[u+1]){
				swap(to[fr[u]],to[fr[u+1]]);
				swap(fr[u],fr[u+1]);
			}
			else break;
			for(;u>=2;u--)
			if(a[fr[u]]<a[fr[u-1]]){
				swap(to[fr[u]],to[fr[u-1]]);
				swap(fr[u],fr[u-1]);
			}
			else if(a[fr[u]]==a[fr[u-1]]&&fr[u]<fr[u-1]){
				swap(to[fr[u]],to[fr[u-1]]);
				swap(fr[u],fr[u-1]);
			}
			else break;
		}
		else if(op==2){
			scanf("%d",&u);
			printf("%d\n",to[u]);
		}
	}
	return 0;
}

